home *** CD-ROM | disk | FTP | other *** search
- /* System-dependent definitions of various files, spool directories, etc */
- /* Mods by PA0GRI */
- /* Modified to allow for configurable file names/locations - WG7J */
- #include <stdio.h>
- #include "global.h"
- #include "config.h"
- #include "netuser.h"
- #include "files.h"
-
- #ifdef MSDOS
- char *Startup = "/autoexec.nos"; /* Initialization file */
- char *Userfile = "/ftpusers"; /* Authorized FTP users and passwords */
- char *Hostfile = "/net.rc"; /* hosts and passwords */
- char *Maillog = "/spool/mail.log"; /* mail log */
- char *Mailspool = "/spool/mail"; /* Incoming mail */
- char *Mailqdir = "/spool/mqueue"; /* Outgoing mail spool */
- char *Mailqueue = "/spool/mqueue/*.wrk"; /* Outgoing mail work files */
- char *Routeqdir = "/spool/rqueue"; /* queue for router */
- char *Alias = "/alias"; /* the alias file */
- char *Dfile = "/domain.txt"; /* Domain cache */
- char *Fdir = "/finger"; /* Finger info directory */
- char *Fdbase = "/finger/dbase.dat"; /* Finger database */
- char *Arealist = "/spool/areas"; /* List of message areas */
- char *Rewritefile = "/spool/rewrite"; /* Address rewrite file */
- char *Ftpmotd = "/spool/ftpmotd.txt"; /* FTP message of the day */
- #ifdef MAILBOX
- char *Signature = "/spool/signatur"; /* Mail signature file directory */
- char *Historyfile = "/spool/history"; /* Message ID history file */
- char *Helpdir = "/spool/help"; /* Mailbox help file directory */
- char *Motdfile = "/spool/motd.txt"; /* Mailbox message of the day */
- #ifdef USERLOG
- char *UDefaults = "/spool/users.dat"; /* User preference file */
- char *UDefbak = "/spool/users.bak";
- #endif
- #endif /* MAILBOX */
- #ifdef CONVERS
- char *Cinfo = "/finger/dbase.dat"; /* Convers user info file */
- #endif
- #if (defined(POP) || defined(POP2CLIENT) || defined(POP2SERVER) || defined(POP3CLIENT) || defined(POP3SERVER))
- char *Popusers = "/popusers"; /* POP user and password file */
- #endif
- #if (defined(NNTP) || defined(NNTPS))
- char *Newsdir = "/spool/news"; /* News messages and NNTP data */
- #endif
- #ifdef MBFWD
- char *Forwardfile = "/spool/forward.bbs"; /* Mail forwarding file */
- #endif
- #ifdef NETROM
- char *Netromfile = "/netrom.sav"; /* Netrom node save file */
- #endif
- char *Onexit = "/onexit.nos"; /* Commands to be executed on exiting */
- #ifdef EXPIRY
- char *Expirefile = "/spool/expire.dat"; /* Message expiration control file */
- #endif
- #ifdef NNTPS
- char *Active = "/spool/news/active"; /* */
- char *Pointer = "/spool/news/pointer"; /* */
- char *NInfo = "/spool/news/info"; /* */
- char *Nhelp = "/spool/news/help"; /* */
- char *History = "/spool/news/history"; /* */
- char *Forward = "/spool/news/forward"; /* */
- char *Poll = "/spool/news/poll"; /* */
- #endif
- char Eol[] = "\r\n";
- #define SEPARATOR "/"
- #define ROOTDIR "/"
- #endif
-
- #ifdef UNIX
- /*
- * DOS compatible names now used. If you used the old names, use compat.cfg
- * as a configuration file to get things working, then rename/symlink as needed
- * --- the new names are the same as the old DOS ones, so it should be easy.
- *
- * We now use this more as a resource file than as merely a list of filenames
- * (we can get away with it, where this costs precious memory in DOS). Some
- * of the things found here are the default session managers for the Command
- * and Trace sessions and color information (when implemented).
- */
- char *Startup = "./autoexec.nos"; /* Initialization file */
- char *Hostfile = "./net.rc"; /* hosts and passwords */
- char *Userfile = "./ftpusers";
- char *Ftpmotd = "./spool/ftpmotd.txt"; /* FTP message of the day */
- char *Mailspool = "./spool/mail";
- char *Maillog = "./spool/mail.log"; /* mail log */
- char *Mailqdir = "./spool/mqueue";
- char *Mailqueue = "./spool/mqueue/*.wrk";
- char *Routeqdir = "./spool/rqueue"; /* queue for router */
- char *Alias = "./alias"; /* the alias file */
- char *Dfile = "./domain.txt"; /* Domain cache */
- char *Fdir = "./finger"; /* Finger info directory */
- char *Motdfile = "./spool/motd.txt"; /* Mailbox message of the day */
- char *Fdbase = "./finger/dbase.dat"; /* Finger database */
- char *Arealist = "./spool/areas"; /* List of message areas */
- char *Helpdir = "./spool/help"; /* Mailbox help file directory */
- char *Rewritefile = "./spool/rewrite"; /* Address rewrite file */
- char *Signature = "./spool/signatur"; /* Mail signature file directory */
- char *Popusers = "./popusers"; /* POP user and password file */
- char *Newsdir = "./spool/news"; /* News messages and NNTP data */
- char *Forwardfile = "./spool/forward.bbs"; /* Mail forwarding file */
- char *Historyfile = "./spool/history"; /* Message ID history file */
- char *Netromfile = "./netrom.sav"; /* Netrom node save file */
- char *UDefaults = "./spool/users.dat"; /* User preference file */
- char *UDefbak = "./spool/users.bak";
- #ifdef CONVERS
- char *Cinfo = "./finger/dbase.dat"; /* Convers user info file */
- #endif
- char *Onexit = "./onexit.nos"; /* Commands to be executed on exiting */
- char *Expirefile = "./spool/expire.dat"; /* Message expiration control file */
- #ifdef NNTPS
- char *Active = "./spool/news/active"; /* */
- char *Pointer = "./spool/news/pointer"; /* */
- char *NInfo = "./spool/news/info"; /* */
- char *Nhelp = "./spool/news/help"; /* */
- char *History = "./spool/news/history"; /* */
- char *Forward = "./spool/news/forward"; /* */
- char *Poll = "./spool/news/poll"; /* */
- #endif
- char Eol[] = "\n";
- #define SEPARATOR "/"
- #define ROOTDIR "."
- /* default session managers */
- char *Command_sessmgr = "";
- char *Trace_sessmgr = "";
- #endif
-
- #ifdef AMIGA
- char *Startup = "TCPIP:nos-startup";
- char *Config = "TCPIP:config.nos"; /* Device configuration list */
- char *Hostfile = "TCPIP:net.rc"; /* hosts and passwords */
- char *Userfile = "TCPIP:ftpusers";
- char *Mailspool = "TCPIP:spool/mail";
- char *Maillog = "TCPIP:spool/mail.log";
- char *Mailqdir = "TCPIP:spool/mqueue";
- char *Mailqueue = "TCPIP:spool/mqueue/#?.wrk";
- char *Routeqdir = "TCPIP:spool/rqueue"; /* queue for router */
- char *Alias = "TCPIP:alias"; /* the alias file */
- char *Dfile = "TCPIP:domain.txt"; /* Domain cache */
- char *Fdir = "TCPIP:finger"; /* Finger info directory */
- char *Fdbase = "TCPIP:finger/dbase.dat"; /* Finger database */
- char *Arealist = "TCPIP:spool/areas"; /* List of message areas */
- char *Helpdir = "TCPIP:spool/help"; /* Mailbox help file directory */
- char *Rewritefile = "TCPIP:spool/rewrite"; /* Address rewrite file */
- char *Signature = "TCPIP:spool/signatur"; /* Mail signature file directory */
- char *Popusers = "TCPIP:/popusers"; /* POP user and password file */
- char *Newsdir = "TCPIP:spool/news"; /* News messages and NNTP data */
- char *Forwardfile = "TCPIP:spool/forward.bbs"; /* Mail forwarding file */
- char *Historyfile = "TCPIP:spool/history"; /* Message ID history file */
- char *UDefaults = "TCPIP:spool/users.dat"; /* User preference file */
- char *Netromfile = "TCPIP:netrom.sav"; /* Netrom node save file */
- char *Onexit = "TCPIP:onexit.nos"; /* Commands to be executed on exiting */
- char *Expirefile = "TCPIP:spool/expire.dat"; /* Message expiration control file */
- #ifdef NNTPS
- char *Active = "TCPIP:spool/news/active"; /* */
- char *Pointer = "TCPIP:spool/news/pointer"; /* */
- char *NInfo = "TCPIP:spool/news/info"; /* */
- char *Nhelp = "TCPIP:spool/news/help"; /* */
- char *History = "TCPIP:spool/news/history"; /* */
- char *Forward = "TCPIP:spool/news/forward"; /* */
- char *Poll = "TCPIP:spool/news/poll"; /* */
- #endif
- char Eol[] = "\r\n";
- #define SEPARATOR "/"
- #endif
-
- #ifdef MAC
- char *Startup = "Mikes Hard Disk:nos.start";
- char *Config = "Mikes Hard Disk:config.nos"; /* Device configuration list */
- char *Hostfile = "Mikes Hard Disk:net.rc"; /* hosts and passwords */
- char *Userfile = "Mikes Hard Disk:ftpusers";
- char *Mailspool = "Mikes Hard Disk:spool:mail:";
- char *Maillog = "Mikes Hard Disk:spool:mail.log:";
- char *Mailqdir = "Mikes Hard Disk:spool:mqueue:";
- char *Mailqueue = "Mikes Hard Disk:spool:mqueue:*.wrk";
- char *Routeqdir = "Mikes Hard Disk:spool/rqueue:"; /* queue for router */
- char *Alias = "Mikes Hard Disk:alias"; /* the alias file */
- char *Dfile = "Mikes Hard Disk:domain:txt"; /* Domain cache */
- char *Fdir = "Mikes Hard Disk:finger"; /* Finger info directory */
- char *Fdbase = "Mikes Hard Disk:finger/dbase.dat"; /* Finger database */
- char *Arealist = "Mikes Hard Disk:spool/areas"; /* List of message areas */
- char *Helpdir = "Mikes Hard Disk:spool/help"; /* Mailbox help file directory */
- char *Rewritefile = "Mikes Hard Disk:spool/rewrite"; /* Address rewrite file */
- char *Signature = "Mikes Hard Disk:spool/signatur"; /* Mail signature file directory */
- char *Popusers = "Mikes Hard Disk:/popusers"; /* POP user and password file */
- char *Newsdir = "Mikes Hard Disk:spool/news"; /* News messages and NNTP data */
- char *Forwardfile = "Mikes Hard Disk:spool/forward.bbs"; /* Mail forwarding file */
- char *Historyfile = "Mikes Hard Disk:spool/history"; /* Message ID history file */
- char *UDefaults = "Mikes Hard Disk:spool/users.dat"; /* User preference file */
- char *Netromfile = "Mikes Hard Disk:netrom.sav"; /* Netrom node save file */
- char *Onexit = "Mikes Hard Disk:onexit.nos"; /* Commands to be executed on exiting */
- char *Expirefile = "Mikes Hard Disk:spool/expire.dat"; /* Message expiration control file */
- #ifdef NNTPS
- char *Active = "Mikes Hard Disk:spool/news/active"; /* */
- char *Pointer = "Mikes Hard Disk:spool/news/pointer"; /* */
- char *NInfo = "Mikes Hard Disk:spool/news/info"; /* */
- char *Nhelp = "Mikes Hard Disk:spool/news/help"; /* */
- char *History = "Mikes Hard Disk:spool/news/history"; /* */
- char *Forward = "Mikes Hard Disk:spool/news/forward"; /* */
- char *Poll = "Mikes Hard Disk:spool/news/poll"; /* */
- #endif
- char Eol[] = "\r";
- #define SEPARATOR ":"
- #endif
-
- static char *rootdir = ROOTDIR;
- static int Assigned;
- static int Initroot;
-
- static void setname __ARGS((char *name,char *file));
- static void tabs_to_spaces __ARGS((char *p));
- void assign_filenames __ARGS((char *config));
-
- extern void undosify __ARGS((char *s));
-
- /* Establish a root directory other than the default. Can only be called
- * once, at startup time
- */
- void
- initroot(root)
- char *root;
- {
- if(Assigned) {
- tprintf("-f option used, -d ignored !\n");
- return;
- }
- #ifdef MSDOS
- undosify(root);
- #endif
- rootdir = strdup( root );
-
- Startup = rootdircat(Startup);
- Userfile = rootdircat(Userfile);
- Hostfile = rootdircat(Hostfile);
- Maillog = rootdircat(Maillog);
- Mailspool = rootdircat(Mailspool);
- Mailqdir = rootdircat(Mailqdir);
- Mailqueue = rootdircat(Mailqueue);
- Routeqdir = rootdircat(Routeqdir);
- Alias = rootdircat(Alias);
- Dfile = rootdircat(Dfile);
- Fdir = rootdircat(Fdir);
- Fdbase = rootdircat(Fdbase);
- Arealist = rootdircat(Arealist);
- Rewritefile = rootdircat(Rewritefile);
- Ftpmotd = rootdircat(Ftpmotd);
- #ifdef MAILBOX
- Signature = rootdircat(Signature);
- Historyfile = rootdircat(Historyfile);
- Helpdir = rootdircat(Helpdir);
- Motdfile = rootdircat(Motdfile);
- #ifdef USERLOG
- UDefaults = rootdircat(UDefaults);
- UDefbak = rootdircat(UDefbak);
- #endif
- #endif
- #ifdef CONVERS
- Cinfo = rootdircat(Cinfo);
- #endif
- #if (defined(POP) || defined(POP2CLIENT) || defined(POP2SERVER) || defined(POP3CLIENT) || defined(POP3SERVER))
- Popusers = rootdircat(Popusers);
- #endif
- #if (defined(NNTP) || defined(NNTPS))
- Newsdir = rootdircat(Newsdir);
- #endif
- #ifdef MBFWD
- Forwardfile = rootdircat(Forwardfile);
- #endif
- #ifdef NETROM
- Netromfile = rootdircat(Netromfile);
- #endif
- Onexit = rootdircat(Onexit);
- #ifdef EXPIRY
- Expirefile = rootdircat(Expirefile);
- #endif
- #ifdef NNTPS
- Active = rootdircat(Active);
- Pointer = rootdircat(Pointer);
- NInfo = rootdircat(NInfo);
- Nhelp = rootdircat(Nhelp);
- History = rootdircat(History);
- Forward = rootdircat(Forward);
- Poll = rootdircat(Poll);
- #endif
- Initroot = 1;
- }
-
- /* Concatenate root, separator and arg strings into a malloc'ed output
- * buffer, then remove repeated occurrences of the separator char
- */
- char *
- rootdircat(filename)
- char *filename;
- {
- char *out = filename;
-
- if(strlen(rootdir) > 0){
- char *separator = SEPARATOR;
- out = mallocw(strlen(rootdir)
- + strlen(separator)
- + strlen(filename) +1);
- strcpy(out,rootdir);
- strcat(out,separator);
- strcat(out,filename);
- if(*separator != '\0'){
- char *p1, *p2;
- /* Remove any repeated occurrences */
- p1 = p2 = out;
- while(*p2 != '\0'){
- *p1++ = *p2++;
- while(p2[0] == p2[-1] && p2[0] == *separator)
- p2++;
- }
- *p1 = '\0';
- }
- }
- return out;
- }
-
- #ifdef PPP
- /* Read through FTPUSERS looking for user record
- * Returns line which matches username, or NULLCHAR when no match.
- * Each of the other variables must be copied before freeing the line.
- */
- char *
- userlookup(username,password,directory,permission,ip_address)
- char *username;
- char **password;
- char **directory;
- long *permission;
- int32 *ip_address;
- {
- FILE *fp;
- char *buf;
- char *cp;
-
- if((fp = fopen(Userfile,READ_TEXT)) == NULLFILE)
- /* Userfile doesn't exist */
- return NULLCHAR;
-
- buf = mallocw(128);
- #ifdef __GNUC__
- cp = 0; /* silence "uninitialized" warning */
- #endif
- while ( fgets(buf,128,fp) != NULLCHAR ){
- if(*buf == '#')
- continue; /* Comment */
-
- if((cp = strchr(buf,' ')) == NULLCHAR)
- /* Bogus entry */
- continue;
- *cp++ = '\0'; /* Now points to password */
-
- if( stricmp(username,buf) == 0 )
- break; /* Found user */
- }
- if(feof(fp)){
- /* username not found in file */
- fclose(fp);
- free(buf);
- return NULLCHAR;
- }
- fclose(fp);
-
- if ( password != NULL )
- *password = cp;
-
- /* Look for space after password field in file */
- if((cp = strchr(cp,' ')) == NULLCHAR) {
- /* Invalid file entry */
- free(buf);
- return NULLCHAR;
- }
- *cp++ = '\0'; /* Now points to directory field */
-
- if ( directory != NULL )
- *directory = cp;
-
- if((cp = strchr(cp,' ')) == NULLCHAR) {
- /* Permission field missing */
- free(buf);
- return NULLCHAR;
- }
- *cp++ = '\0'; /* now points to permission field */
-
- if (permission != NULL )
- *permission = strtol( cp, NULLCHARP, 0 );
-
- if((cp = strchr(cp,' ')) == NULLCHAR) {
- /* IP address missing */
- if ( ip_address != NULL )
- *ip_address = 0L;
- } else {
- *cp++ = '\0'; /* now points at IP address field */
- if ( ip_address != NULL )
- *ip_address = resolve( cp );
- }
- return buf;
- }
- #endif
-
- /* Subroutine for logging in the user whose name is name and password is pass.
- The buffer path should be long enough to keep a line from the userfile.
- If pwdignore is true, the password check will be overridden.
- The return value is the permissions field or -1 if the login failed.
- Path is set to point at the path field, and pwdignore will be true if no
- particular password was needed for this user.
- */
- long
- userlogin(name,pass,path,len,pwdignore)
- char *name;
- char *pass;
- char **path;
- int len; /* Length of buffer pointed at by *path */
- int *pwdignore;
- {
- char *cp,*cp1;
- FILE *fp;
- char *universal = NULLCHAR;
- int anony,perm;
-
- if((fp = fopen(Userfile,READ_TEXT)) == NULLFILE)
- /* Userfile doesn't exist */
- return -1;
- #ifdef __GNUC__
- cp = 0; /* silence warning */
- #endif
- while(fgets(*path,len,fp),!feof(fp)){
- if(*path[0] == '#')
- continue; /* Comment */
- if((cp = strchr(*path,' ')) == NULLCHAR)
- /* Bogus entry */
- continue;
- *cp++ = '\0'; /* Now points to password */
- if(stricmp(name,*path) == 0)
- break; /* Found user name */
- if(stricmp("univperm",*path) == 0)
- universal = strdup(cp); /* remember their anon entry */
- }
- if((universal == NULLCHAR) && (feof(fp))){
- /* User name not found in file, nor was univperm */
- fclose(fp);
- /* No need to free universal ( == NULLCHAR ) remember !!! */
- return -1;
- }
- if(feof(fp)){
- /* restore anonymous to the buffer */
- strcpy(cp = *path, universal);
- free(universal);
- universal = NULLCHAR;
- }
- if(universal != NULLCHAR)
- free(universal);
- fclose(fp);
- /* Look for space after password field in file */
- if((cp1 = strchr(cp,' ')) == NULLCHAR)
- /* Invalid file entry */
- return -1;
- *cp1++ = '\0'; /* Now points to path field */
- anony = *pwdignore;
- if(strcmp(cp,"*") == 0)
- anony = 1; /* User ID is password-free */
- if(!anony && strcmp(cp,pass) != 0)
- /* Password required, but wrong one given */
- return -1;
- if((cp = strchr(cp1,' ')) == NULLCHAR)
- /* Permission field missing */
- return -1;
- *cp++ = '\0'; /* now points to permission field */
- if(!strnicmp(cp,"0x",2))
- perm = htol(cp);
- else
- perm = atol(cp);
- #if defined(AMIGA)
- /*
- * Well, on the Amiga, a file can be referenced by many names:
- * device names (DF0:) or volume names (My_Disk:). This hunk of code
- * passed the pathname specified in the ftpusers file, and gets the
- * absolute path copied into the user's buffer. We really should just
- * allocate the buffer and return a pointer to it, since the caller
- * really doesn't have a good idea how long the path string is..
- */
- cp1 = pathname("", cp1);
- if (cp1)
- strcpy(*path, cp1);
- else
- **path = '\0';
- free(cp1);
- #else
- strcpy(*path,cp1);
- /* Convert any backslashes to forward slashes, for backward
- * compatibility with the old NET
- */
- while((cp = strchr(*path,'\\')) != NULLCHAR)
- *cp = '/';
- #endif
- *pwdignore = anony;
- /* Finally return the permission bits */
- return perm;
- }
-
- #if defined(MSDOS) || defined(UNIX)
- void setname(char *name,char *file) {
-
- if(!stricmp("Startup",name)) {
- if(Initroot)
- free(Startup);
- Startup = strdup(file);
- } else if(!stricmp("Userfile",name)) {
- if(Initroot)
- free(Userfile);
- Userfile = strdup(file);
- } else if(!stricmp("Hostfile",name)) {
- if(Initroot)
- free(Hostfile);
- Hostfile = strdup(file);
- } else if(!stricmp("Maillog",name)) {
- if(Initroot)
- free(Maillog);
- Maillog = strdup(file);
- } else if(!stricmp("Mailspool",name)) {
- if(Initroot)
- free(Mailspool);
- Mailspool = strdup(file);
- } else if(!stricmp("Mailqdir",name)) {
- if(Initroot)
- free(Mailqdir);
- Mailqdir = strdup(file);
- } else if(!stricmp("Mailqueue",name)) {
- if(Initroot)
- free(Mailqueue);
- Mailqueue = strdup(file);
- } else if(!stricmp("Routeqdir",name)) {
- if(Initroot)
- free(Routeqdir);
- Routeqdir = strdup(file);
- } else if(!stricmp("Alias",name)) {
- if(Initroot)
- free(Alias);
- Alias = strdup(file);
- } else if(!stricmp("Dfile",name)) {
- if(Initroot)
- free(Dfile);
- Dfile = strdup(file);
- } else if(!stricmp("Fdir",name)) {
- if(Initroot)
- free(Fdir);
- Fdir = strdup(file);
- } else if(!stricmp("Fdbase",name)) {
- if(Initroot)
- free(Fdbase);
- Fdbase = strdup(file);
- } else if(!stricmp("Arealist",name)) {
- if(Initroot)
- free(Arealist);
- Arealist = strdup(file);
- } else if(!stricmp("Rewritefile",name)) {
- if(Initroot)
- free(Rewritefile);
- Rewritefile = strdup(file);
- } else if(!stricmp("Onexit",name)) {
- if(Initroot)
- free(Onexit);
- Onexit = strdup(file);
- } else if(!stricmp("Ftpmotd",name)) {
- if(Initroot)
- free(Ftpmotd);
- Ftpmotd = strdup(file);
- }
- #ifdef MAILBOX
- else if(!stricmp("Signature",name)) {
- if(Initroot)
- free(Signature);
- Signature = strdup(file);
- } else if(!stricmp("Historyfile",name)) {
- if(Initroot)
- free(Historyfile);
- Historyfile = strdup(file);
- } else if(!stricmp("Helpdir",name)) {
- if(Initroot)
- free(Helpdir);
- Helpdir = strdup(file);
- } else if(!stricmp("Motdfile",name)) {
- if(Initroot)
- free(Motdfile);
- Motdfile = strdup(file);
- }
- #ifdef USERLOG
- else if(!stricmp("UDefaults",name)) {
- if(Initroot)
- free(UDefaults);
- UDefaults = strdup(file);
- } else if(!stricmp("UDefbak",name)) {
- if(Initroot)
- free(UDefbak);
- UDefbak = strdup(file);
- }
- #endif
- #endif
- #ifdef CONVERS
- else if(!stricmp("Cinfo",name)) {
- if(Initroot)
- free(Cinfo);
- Cinfo = strdup(file);
- }
- #endif
- #if (defined(POP) || defined(POP2CLIENT) || defined(POP2SERVER) || defined(POP3CLIENT) || defined(POP3SERVER))
- else if(!stricmp("Popusers",name)) {
- if(Initroot)
- free(Popusers);
- Popusers = strdup(file);
- }
- #endif
- #if (defined(NNTP) || defined(NNTPS))
- else if(!stricmp("Newsdir",name)) {
- if(Initroot)
- free(Newsdir);
- Newsdir = strdup(file);
- }
- #endif
- #ifdef MBFWD
- else if(!stricmp("Forwardfile",name)) {
- if(Initroot)
- free(Forwardfile);
- Forwardfile = strdup(file);
- }
- #endif
- #ifdef NETROM
- else if(!stricmp("Netromfile",name)) {
- if(Initroot)
- free(Netromfile);
- Netromfile = strdup(file);
- }
- #endif
- #ifdef EXPIRY
- else if(!stricmp("Expirefile",name)) {
- if(Initroot)
- free(Expirefile);
- Expirefile = strdup(file);
- }
- #endif
- #ifdef NNTPS
- else if(!stricmp("Active",name)) {
- if(Initroot)
- free(Active);
- Active = strdup(file);
- } else if(!stricmp("Pointer",name)) {
- if(Initroot)
- free(Pointer);
- Pointer = strdup(file);
- } else if(!stricmp("NInfo",name)) {
- if(Initroot)
- free(NInfo);
- NInfo = strdup(file);
- } else if(!stricmp("Nhelp",name)) {
- if(Initroot)
- free(Nhelp);
- Nhelp = strdup(file);
- } else if(!stricmp("History",name)) {
- if(Initroot)
- free(History);
- History = strdup(file);
- } else if(!stricmp("Forward",name)) {
- if(Initroot)
- free(Forward);
- Forward = strdup(file);
- } else if(!stricmp("Poll",name)) {
- if(Initroot)
- free(Poll);
- Poll = strdup(file);
- }
- #endif
- #ifdef UNIX
- else if (stricmp(name, "Command") == 0)
- {
- if (Initroot) free(Command_sessmgr);
- Command_sessmgr = strdup(file);
- }
- else if (stricmp(name, "Trace") == 0)
- {
- if (Initroot) free(Trace_sessmgr);
- Trace_sessmgr = strdup(file);
- }
- #endif
- }
-
- void tabs_to_spaces(char *p) {
- while(*p != '\0') {
- if(*p == '\t')
- *p = ' ';
- p++;
- }
- }
-
- void
- assign_filenames(char *config) {
- FILE *fp;
- char *name,*file,*cp;
- int line;
- #define BUFLEN 128
- char buf[BUFLEN+1];
-
- #ifdef MSDOS
- undosify(config);
- #endif
- if((fp = fopen(config,"r")) == NULL) {
- tprintf("Cannot open %s\n",config);
- return;
- }
-
- line = 0;
- while(fgets(buf,BUFLEN,fp) != NULL) {
- line++;
- if(*buf == '#') /* comment */
- continue;
- rip(buf); /* delete ending \n */
- tabs_to_spaces(buf);
- name = buf;
- while(*name == ' ') /* no leading spaces */
- name++;
- if(*name == '\0') /* blank line */
- continue;
- /* Search for filename */
- if((file = strchr(name,'=')) == NULL) {
- tprintf("Need '=', line %d of %s.\n",line,config);
- continue;
- }
- *file++ = '\0';
- /* cut trailing spaces */
- if((cp = strchr(name,' ')) != NULL)
- *cp = '\0';
-
- /* find start of filename */
- while(*file == ' ')
- file++;
-
- if(*file == '\0')
- continue;
-
- /* cut trailing spaces */
- if((cp = strchr(file,' ')) != NULL)
- *cp = '\0';
-
- /* Now parse the name, and assign if valid */
- setname(name,file);
- }
- fclose(fp);
- Assigned = 1;
- }
- #endif
-
-